var http = require('http');
var url = require('url');
var querystring = require('querystring');
var util = require('util');

var server = http.createServer(function(req,res){
	var pathname = url.parse(req.url).pathname;
	var username = querystring.parse(url.parse(req.url).query).username;
	var email = querystring.parse(url.parse(req.url).query).email;
	console.log(pathname);
	if(pathname == "/index"){
		res.writeHead(200 , {"Content-Type":"text/html"});
		res.write("Your username is : "  + username + "</br>");
		res.write("Your email is : "  + email);
		res.end(); 
	}else{
		res.writeHead(200 , {"Content-Type":"text/html"});
		res.end("<h1>I can't find the page! Please visit /index...</h1>");
	}
});
server.listen(8888);
console.log("Pleaes viste: http://localhost:8888/index?username=zhangsan&email=1@qq.com");